Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CQE incremental fixes part 2 #6419

Merged
merged 6 commits into from
Oct 18, 2024
Merged

Conversation

P33M
Copy link
Contributor

@P33M P33M commented Oct 15, 2024

If #6418 fixes the generic case of a hang on boot with an A2 card, then this PR should be merged.

The 2nd commit should be a no-op, as I placed an assert in cqe_off() for cq_host->qcnt != 0 and it never fired. As it turns out, mmcblk /does/ serialise async requests if a synchronous one arrives, and the existing claim mechanism should prevent other contexts from running in parallel. Retuning is a bit special as it is invoked prior to starting either a cqe or regular request, but it appears to have been thought about.

The third commit should disable CQ on older Sandisk cards such as https://forums.raspberrypi.com/viewtopic.php?t=367459&start=25#p2208495 (and I have one of these).

@P33M
Copy link
Contributor Author

P33M commented Oct 17, 2024

From my testing, the loop that previously failed in 20 minutes survived an overnight run. There's one positive response in the issue, and one pending.

@P33M
Copy link
Contributor Author

P33M commented Oct 18, 2024

This PR now fixes two definite bugs in the CQ implementation so the default can switch back to enabled for supported cards. During testing there was a mild panic as the other "known good" A2 card from Integral would reliably break the filesystem if trimmed. However, that's unrelated to CQ - it just doesn't erase properly.

Posted write tracking introduced in the commit below raced with re-use
of the requests between completion and submission, potentially causing
underflow of the pending write count.

Fixes: e6c1e86 ("mmc: restrict posted write counts for SD cards in CQ mode")

Signed-off-by: Jonathan Bell <[email protected]>
__mmc_start_request turns CQE off before issuing the actual command so
this additional call is redundant.

This reverts commit 8e40644.
Cards with manufacture dates in 2019 and 2020 have been seen in the wild
that hang indefinitely if issued a cache flush command in CQ mode.

Signed-off-by: Jonathan Bell <[email protected]>
Only CMD38 with Arg=0x1 (Discard) is supported when in CQ mode, so
turn it off before issuing a non-discard erase op.

Signed-off-by: Jonathan Bell <[email protected]>
This reverts commit 1b92c93.

Signed-off-by: Jonathan Bell <[email protected]>
Recent Integral cards end up with corrupt sectors after a flash erase.
This covers sizes for the A2 range, which can't be differentiated from
the A1 range which might not have the same issue.

Signed-off-by: Jonathan Bell <[email protected]>
@pelwell pelwell merged commit 527d6f5 into raspberrypi:rpi-6.6.y Oct 18, 2024
11 of 12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Oct 18, 2024
See: raspberrypi/linux#6421

kernel: Fixes for video-mux with Pi5
See: raspberrypi/linux#6410

kernel: OV5647 link frequency control
See: raspberrypi/linux#6423

kernel: CQE incremental fixes part 2
See: raspberrypi/linux#6419
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Oct 18, 2024
See: raspberrypi/linux#6421

kernel: Fixes for video-mux with Pi5
See: raspberrypi/linux#6410

kernel: OV5647 link frequency control
See: raspberrypi/linux#6423

kernel: CQE incremental fixes part 2
See: raspberrypi/linux#6419
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants